import requests
import hashlib
import time

total = 0
headers = {
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36',
    'cookie':'sessionid=dbn70q9i6gw4blvxphcjodbub6dofq3y',
    'referer':'https://www.mashangpa.com/problem-detail/3/',
}
# window.md5("tuling" + timestamp + pageNumber)
for i in range(1,21):
    time_stamp = int(time.time()*1000)
    data = 'tuling'+f'{time_stamp}'+f'{i}'
    token = hashlib.md5(data.encode('utf8')).hexdigest()
    print(token)
    params={
        'page':i,
        'sign':token,
        '_ts':time_stamp,
    }
    url = f'https://www.mashangpa.com/api/problem-detail/4/data/'
    response = requests.get(url,headers=headers,params=params)
    items = response.json()['current_array']
    for item in items:
        total += item
print(total)